Beginning iOS Programming For Dummies by Rajiv Ramnath & Cheyney Loffing
Author:Rajiv Ramnath & Cheyney Loffing
Language: eng
Format: epub
ISBN: 9781118799314
Published: 2014-03-24T22:21:29+00:00
Figure 7-7 shows the views that the Game Session view controller manages.
Figure 7-7: View managed by the Game Session view controller.
The board is a custom view that's implemented by the TTTBoard class, which is a subclass of UIView. Here is the interface file for the TTTBoard class:
//
//
...
#import <UIKit/UIKit.h>
#import "TTTGameSessionViewController.h"
@class TTTGameGrid;
@interface TTTBoard : UIView{
@private BOOL enabled;
@private TTTGameSessionViewController *gameSession;
@private TTTGameGrid *grid;
@private float width; // width of one block
@private float height; // will be same as width;
}
- (void)drawRect:(CGRect)rect;
- (void) setGrid: (TTTGameGrid *) aGrid;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void) setGameSession: (TTTGameSessionViewController *) aGameSession;
- (float) getWidth;
- (float) getHeight;
- (void) invalidateBlock: (int) x :(int) y;
- (BOOL) isInputEnabled;
- (void) disableInput;
- (void) enableInput;
@end
Next, I explain what the important methods in this class do, and how they work:
TTTBoard is specialized from UIView in that it overrides the drawRect method from UIView and implements its own method. This drawRect method is the one that draws the Tic-Tac-Toe grid along with all the played symbols when the board changes (that is, after each move). The drawRect method is automatically called by the iOS runtime system or, more specifically, by the view manager within iOS when the view needs to be rendered.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
What's Done in Darkness by Kayla Perrin(26591)
The Fifty Shades Trilogy & Grey by E L James(19078)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19057)
Shot Through the Heart by Mercy Celeste(18935)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(17110)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(16989)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16874)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16823)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16445)
The Subtle Art of Not Giving a F*ck by Mark Manson(14352)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14128)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13622)
Scorched Earth by Nick Kyme(12767)
Drei Generationen auf dem Jakobsweg by Stein Pia(10964)
Suna by Ziefle Pia(10888)
Scythe by Neal Shusterman(10334)
International Relations from the Global South; Worlds of Difference; First Edition by Arlene B. Tickner & Karen Smith(9520)
Successful Proposal Strategies for Small Businesses: Using Knowledge Management ot Win Govenment, Private Sector, and International Contracts 3rd Edition by Robert Frey(9366)
The Ultimate Python Exercise Book: 700 Practical Exercises for Beginners with Quiz Questions by Copy(9341)
